const {
	submitMethod,
} = require('./api-bug-methods')

module.exports = function(apiComp) {
	let {
		bugBtn,
		bugDialog,
		bugText,
	} = apiComp

	bugBtn.linkbutton({
		iconCls: 'icon-tip',
		// plain: true,
		text: '提交BUG/建议',
		onClick() {
			bugText.textbox('setValue', '')
			bugDialog.dialog('open')
		},
	});

	bugDialog.dialog({
		title: '提交BUG/建议',
		top: 100,
		left: 300,
		width: 800,
		height: 460,
		closed: true,
		modal: true,
		buttons: [{
			text: '提交',
			iconCls: 'icon-save',
			handler: function() {
				submitMethod.call(apiComp)
			}
		}, {
			text: '取消',
			iconCls: 'icon-cancel',
			handler: function() {
				bugDialog.dialog('close')
			}
		}]
	});

	bugText.textbox({
		multiline: true,
	});

}